import 'category_info_model.dart';

class CategoryV3Model {
  List<CategoryInfoModel>? position1;
  List<CategoryInfoModel>? position2;
  List<CategoryInfoModel>? position3;
  String? serviceName;
  String? baikeName;
  // String?  "position_2_name":"世运服务",
  // "position_3_name":"世运百科",

  CategoryV3Model(
      {this.position1,
      this.position2,
      this.position3,
      this.baikeName,
      this.serviceName});

  factory CategoryV3Model.fromJson(Map<String, dynamic> json) {
    return CategoryV3Model(
      position1: (json['position_1'] as List<dynamic>?)
          ?.map((e) => CategoryInfoModel.fromJson(e as Map<String, dynamic>))
          .toList(),
      position2: (json['position_2'] as List<dynamic>?)
          ?.map((e) => CategoryInfoModel.fromJson(e as Map<String, dynamic>))
          .toList(),
      position3: (json['position_3'] as List<dynamic>?)
          ?.map((e) => CategoryInfoModel.fromJson(e as Map<String, dynamic>))
          .toList(),
      serviceName: json['position_2_name'],
      baikeName: json['position_3_name'],
    );
  }

  Map<String, dynamic> toJson() => {
        'position_1': position1?.map((e) => e.toJson()).toList(),
        'position_2': position2?.map((e) => e.toJson()).toList(),
        'position_3': position3?.map((e) => e.toJson()).toList(),
        "position_2_name": serviceName,
        "position_3_name": baikeName,
      };
}
